package com.qingyun.form.items

import android.view.LayoutInflater
import android.view.ViewGroup
import com.qingyun.form.R
import com.qingyun.form.base.FormType
import com.qingyun.form.base.FormViewHolder
import java.util.UUID

class GroupTitleFormItem(label: String) : BaseFormItem(label, "GT-${UUID.randomUUID()}", null) {
    override val formType: FormType
        get() = FormType.GroupTitle
    override val layoutId: Int
        get() = R.layout.form_item_group_title

    override fun onCreateViewHolder(inflater: LayoutInflater, group: ViewGroup): FormViewHolder {
        return GroupTitleViewHolder(inflater, group, layoutId)
    }

    override fun onBindViewHolder(holder: FormViewHolder) {
        holder.setText(R.id.tvTitle, this.label)
    }

    private class GroupTitleViewHolder(
        inflater: LayoutInflater,
        parent: ViewGroup,
        layoutId: Int,
    ) : FormViewHolder(inflater, parent, layoutId)
}